home *** CD-ROM | disk | FTP | other *** search
- #ifdef __STDC__
- static char sccs_id[] = "@(#) strcpy.c 1.1 "__DATE__" HJR";
- #else
- static char sccs_id[] = "@(#) strcpy.c 1.1 26/9/90 HJR";
- #endif
-
- /* strcpy.c (c) Copyright 1990 H.Rogers */
-
- #ifndef __STDC__
- #include "sys/types.h"
- #endif
- #include <string.h>
-
- #ifdef __STDC__
- char *strcpy(char *s,register const char *s2)
- #else
- char *strcpy(s,s2)
- char *s;
- register const char *s2;
- #endif
- {
- register char *s1 = s;
-
- while (*s1++ = *s2++);
-
- return(s);
- }
-
- #ifdef __STDC__
- char *strncpy(char *s,register const char *s2,register size_t n)
- #else
- char *strncpy(s,s2,n)
- char *s;
- register const char *s2;
- register size_t n;
- #endif
- {
- register char *s1 = s;
-
- while (n--)
- if (!(*s1++ = *s2++))
- { while (n--) *s1++ = 0; return(s); }
-
- return(s);
- }
-